<?php
$container_bl=join("&nbsp;", $form->_button_container["BL"]);
$container_br=join("&nbsp;", $form->_button_container["BR"]);
$container_tr=join("&nbsp;", $form->_button_container["TR"]);

if ($form->_status=='delete' || $form->_action=='delete' || $form->_status=='unknow_record'):
	echo $form->output;
else:

	$html='<tr id="tr_itords_<#i#>">';
	$campos=$form->template_details('itords');
	foreach($campos as $nom=>$nan){
		$pivot=$nan['field'];
		$align = (strpos($pivot,'inputnum')) ? 'align="right"' : '';
		$html.='<td class="littletablerow" '.$align.'>'.$pivot.'</td>';
	}
	if($form->_status!='show') {
		$html.='<td class="littletablerow"><a href=# onclick=\'del_itordi(<#i#>);return false;\'>Eliminar</a></td>';
	}
	$html.='</tr>';


/*foreach($form->detail_fields['itords'] AS $ind=>$data)
	$campos[]=$data['field'];
$campos='<tr id="tr_itords_<#i#>"><td class="littletablerow">'.join('</td><td>',$campos).'</td>';
$campos=str_replace("\n",'',$campos);
$campos.=' <td class="littletablerow"><a href=# onclick="del_itords(<#i#>);return false;">Eliminar</a></td></tr>';*/
$campos=$form->js_escape($html);

if(isset($form->error_string)) echo '<div class="alert">'.$form->error_string.'</div>';

//echo $form_scripts;
echo $form_begin;
if($form->_status!='show'){
?>

<script language="javascript" type="text/javascript">
itords_cont=<?=$form->max_rel_count['itords'] ?>;

function add_itords(){
	var htm = <?php echo $campos; ?>;
	can = itords_cont.toString();
	con = (itords_cont+1).toString();
	htm = htm.replace(/<#i#>/g,can);
	htm = htm.replace(/<#o#>/g,con);
	$("#__UTPL__").before(htm);
	$("#cantidad_"+can).numeric(".");
	itords_cont=itords_cont+1;
}

$(function(){
	$(".inputnum").numeric(".");
});

function del_itords(id){
	id = id.toString();
	$('#tr_itords_'+id).remove();
}
</script>
<?php } ?>
<table align='center' width="80%">
	<tr>
<?php if ($form->_status=='show') { ?>
		<td>
		<a href="#" onclick="window.open('<?php echo base_url() ?>formatos/verhtml/ords/logo/<?php echo $form->numero->value ?>', '_blank', 'width=800, height=600, scrollbars=Yes, status=Yes, resizable=Yes, screenx='+((screen.availWidth/2)-400)+',screeny='+((screen.availHeight/2)-300)+'');" heigth="600" >
		<img src='<?php echo base_url() ?>images/html_icon.gif'></a>
				<a href="#" onclick="window.open('<?php echo base_url() ?>formatos/ver/ords/logo/<?php echo $form->numero->value ?>', '_blank', 'width=800, height=600, scrollbars=Yes, status=Yes, resizable=Yes, screenx='+((screen.availWidth/2)-400)+',screeny='+((screen.availHeight/2)-300)+'');" heigth="600" >
		<img src='<?php echo base_url() ?>images/pdf_logo.gif'></a> Fyco </td>
        <td>		<a href="#" onclick="window.open('<?php echo base_url() ?>formatos/verhtml/ords/logo2/<?php echo $form->numero->value ?>', '_blank', 'width=800, height=600, scrollbars=Yes, status=Yes, resizable=Yes, screenx='+((screen.availWidth/2)-400)+',screeny='+((screen.availHeight/2)-300)+'');" heigth="600" >
		<img src='<?php echo base_url() ?>images/html_icon.gif'></a>
				<a href="#" onclick="window.open('<?php echo base_url() ?>formatos/ver/ords/logo2/<?php echo $form->numero->value ?>', '_blank', 'width=800, height=600, scrollbars=Yes, status=Yes, resizable=Yes, screenx='+((screen.availWidth/2)-400)+',screeny='+((screen.availHeight/2)-300)+'');" heigth="600" >
		<img src='<?php echo base_url() ?>images/pdf_logo.gif'></a> Logistica </td>
	  		<td>
		<a href="#" onclick="window.open('<?php echo base_url() ?>formatos/verhtml/ords2/logo/<?php echo $form->numero->value ?>', '_blank', 'width=800, height=600, scrollbars=Yes, status=Yes, resizable=Yes, screenx='+((screen.availWidth/2)-400)+',screeny='+((screen.availHeight/2)-300)+'');" heigth="600" >
		<img src='<?php echo base_url() ?>images/html_icon.gif'></a>
				<a href="#" onclick="window.open('<?php echo base_url() ?>formatos/ver/ords2/logo/<?php echo $form->numero->value ?>', '_blank', 'width=800, height=600, scrollbars=Yes, status=Yes, resizable=Yes, screenx='+((screen.availWidth/2)-400)+',screeny='+((screen.availHeight/2)-300)+'');" heigth="600" >
		<img src='<?php echo base_url() ?>images/pdf_logo.gif'></a> Fyco English </td>
        <td>		<a href="#" onclick="window.open('<?php echo base_url() ?>formatos/verhtml/ords2/logo2/<?php echo $form->numero->value ?>', '_blank', 'width=800, height=600, scrollbars=Yes, status=Yes, resizable=Yes, screenx='+((screen.availWidth/2)-400)+',screeny='+((screen.availHeight/2)-300)+'');" heigth="600" >
		<img src='<?php echo base_url() ?>images/html_icon.gif'></a>
				<a href="#" onclick="window.open('<?php echo base_url() ?>formatos/ver/ords2/logo2/<?php echo $form->numero->value ?>', '_blank', 'width=800, height=600, scrollbars=Yes, status=Yes, resizable=Yes, screenx='+((screen.availWidth/2)-400)+',screeny='+((screen.availHeight/2)-300)+'');" heigth="600" >
		<img src='<?php echo base_url() ?>images/pdf_logo.gif'></a> Logistica English </td>
      <?php } ?>
		<td align=right><?php echo $container_br?></td>	
		<td align=right><?php echo $container_tr?></td>	
	</tr>
</table>
<table align='center' width="80%">
	<tr>
		<td>
		<fieldset style='border: 2px outset #9AC8DA;background: #FFFFFF;'>
		<legend class="titulofieldset" style='color: #2E4B77;'>Solicitud de Oferta <?php if($form->_status=='show' or $form->_status=='modify' ) echo str_pad($form->numero->output,8,0,0); ?></legend>
		<table width="100%" style="margin: 0; width: 100%;">
			
			<tr >
				<td width="13%" class="littletableheader"><?php echo $form->fecha->label;    ?>*&nbsp;</td>
				<td colspan="2" class="littletablerow">   <?php echo $form->fecha->output;   ?>&nbsp;				  <legend style='color: #000000; font-size:12px'></legend></td>
			</tr>
			<tr>
				<td class="littletableheader"><?php echo $form->proveed->label;  ?></td>
				<td width="13%" class="littletablerow"><?php echo $form->proveed->output; ?></td>
				<td class="littletableheader"><span class="littletablerow"><?php echo $form->rifci->label;  ?><?php echo $form->rifci->output; ?></span></td>
		    </tr>
			<tr>
				<td height="21" class="littletableheader"><?php echo $form->nombre->label;  ?></td>
				<td height="21" colspan="2" class="littletablerow" ><?php echo $form->nombre->output;  ?></td>
			</tr>
			<tr>
			  <td height="21" colspan="3" class="littletableheader">
			  
<table width="100%" border="0" style='width: 100%;border: 1px dotted #297FA2;'>
			<tr>
			  <td width="13%" class="littletableheader"><?php echo $form->arancel->label  ?></td>
			  <td width="87%" colspan='2' class="littletablerow"><?php echo $form->arancel->output ?></td>
		  </tr>
			<tr>
			  <td class="littletableheader"><?php echo $form->paiso->label  ?></td>
			  <td class="littletablerow" colspan='2'><?php echo $form->paiso->output ?></td>
			  </tr>
			<tr>
			  <td class="littletableheader"><?php echo $form->puerto->label  ?></td>
			  <td class="littletablerow" colspan='2'><?php echo $form->puerto->output ?></td>
			  </tr>
			<tr>
			  <td class="littletableheader"><?php echo $form->termino->label  ?></td>
			  <td class="littletablerow" colspan='2'><?php echo $form->termino->output ?></td>
			  </tr>
			</table>			  
			  
			  </td>
		  </tr>
		</table>
		
		</fieldset>	

			</td>
	</tr>
	<tr><td></td></tr>
	<tr>
		<td>
		<table width='100%'>
			<tr>
				<td colspan='4'  bgcolor='#527D9E' align="center" style="color:#000000" >Lista de Art&iacute;culos</td>
			</tr>
			<tr>
				<td class="littletableheader">C&oacute;digo</td>
				<td class="littletableheader">Descripci&oacute;n</td>
				<td class="littletableheader">Cantidad</td>
				<?php if($form->_status!='show') {?>
					<td class="littletableheader">&nbsp;</td>
				<?php } ?>
			</tr>
			<?php for($i=0;$i<$form->max_rel_count['itords'];$i++) {
				$obj1="codigo_$i";
				$obj2="descrip_$i";
				$obj3="cantidad_$i";
			?>
			<tr id='tr_itords_<?=$i ?>'>
				<td class="littletablerow"><?php echo $form->$obj1->output ?></td>
				<td class="littletablerow"><?php echo $form->$obj2->output ?></td>
				<td class="littletablerow"align="right"><?php echo $form->$obj3->output ?></td>
				<?php if($form->_status!='show') {?>
					<td class="littletablerow"><a href=#onclick='del_itords(<?php echo $i; ?>);return false;'>Eliminar</a></td>
				<?php } ?>
			</tr>
			<?php } ?>

			<tr id='__UTPL__'>
				<td class="littletablefooterb" align="right">&nbsp;</td>
				<td class="littletablefooterb" align="right">&nbsp;</td>
				<td class="littletablefooterb" align="right">&nbsp;</td>
				<?php if($form->_status!='show') {?>
				<td class="littletablefooterb" align="right">&nbsp;</td>
				<?php } ?>
			</tr>
			<tr id='__UTPL__'>
			  <td colspan="4" align="right" class="littletablefooterb">
			  </td>
		  </tr>
		</table>
		<?php echo $form_end ?> <?php echo $container_bl ?> <?php echo $container_br ?>		</td>
	</tr>
	<tr>
	  <td>
	 <fieldset style='border: 2px outset #9AC8DA;background: #EFEFEF;'>
		<legend class="titulofieldset" style='color: #2E4B77;' align="left">Condiciones</legend>
		<table width='100%' align="center">
			<tr>
				<td><?php echo $form->condi1->output; ?></td>
			</tr>
			<tr>
				<td><?php echo $form->condi2->output; ?></td>
			</tr>
			<tr>
				<td><?php echo $form->condi3->output; ?></td>
		    </tr>
			<tr>
			  <td><?php echo $form->condi4->output; ?></td>
	      </tr>
		</table>
		</fieldset>		
	  </td>
  </tr>
</table>
<?php endif; ?>